package com.thirteen.peiban.once;

import com.thirteen.peiban.mapper.UserMapper;
import com.thirteen.peiban.model.domain.User;
import org.springframework.stereotype.Component;
import org.springframework.util.StopWatch;

import javax.annotation.Resource;

/**
 * @author 十三
 * @create 2023-12-11 1:01
 * @Description:
 */
@Component
public class InsertUsers {


    @Resource
    private UserMapper userMapper;

    /**
     * 批量输入用户
     */
    //@Scheduled(initialDelay = 5000,fixedRate = Long.MAX_VALUE)
    public void doInsertUsers(){
        StopWatch stopWatch = new StopWatch();
        stopWatch.start();
        final int INSERT_NUM = 1000;
        for (int i = 0;i < INSERT_NUM; i++){
            User user = new User();
            user.setUsername("假十三");
            user.setUserAccount("fakethirteen");
            user.setProfile("啦啦啦啦");
            user.setAvatarUrl("https://www.baidu.com/link?url=3I75MZ_yMh-ATqEZ22hCOvByUead9i4YGvXw1cjXfPeSQZ2Lc8UOs8vC9BFhgXRl_0B-VIp79XqyI2tPaV2szyvg_TaB5xVgG2Cg7AlTAlpX3Xgbi_eTpwZfYNYL_a5dCWflFpXPQQuDEfRUKTTMh7c8AJ2UkjXJr5QX_M7f0LdtsuVVLKKBjV0eZgUtijto7eblNC9VFBubk1zizo4tMWw_sfO83-gYh4lx7a-J84MizcPiySPlF_71iB3Pi7igznDzQY8eZahRVHfwsBNprysHYJyvsUZjYSFOmLkZIpIWo1q34hOJl8LRY7KUci3tNpO9zlmjQBaosQjzekW6-0oRgt64u4k6kuWgx1j9fEZcpcu9plR55zp05ogkAnC4CjWBGsjeLJA3meylTD_j4zpcyIZrd3uUElxEaJeOf5tj6CjATVYrr8vU9pOREm-GZ4M4F1ShKHnia4TUYXHZnrllHp3-Gg2p39F9jMF67Y-IYq4Oe-oZg8UnC6yL2sHLQ8jpBUEMwdEeMakFZZPDLCqsiQ433Z8uDu80ijQyU6Ca1Veu4PY_rVNQVEITg8LAxmTOo-nLPuYECvSKvspHKY7UGnPUpiqntKKUOSgPJWxRjhsv1C4EQ6b655LH4a7s5AVQxbyFT7Ey9vCDvMeicJQTMFiA9TI6MN8mA9mboVOhSP_ARkmSTXSP5kSRLJReUsoCPBtoOoWV_Bg_CYTPZYTv6ysoz3VT0YV5ioCfZMi&wd=&eqid=f40c3306000b3a9f000000066575f02a");
            user.setGender(0);
            user.setUserPassword("12345678");
            user.setPhone("1234");
            user.setEmail("123@qq.com");
            user.setTags("[]");
            user.setUserStatus(0);
            user.setUserRole(0);
            user.setPlanetCode("1111111");
            userMapper.insert(user);
        }
        stopWatch.stop();
        System.out.println(stopWatch.getTotalTimeMillis());
    }

}
